<template>
  <div class="event_warpper">
    <h1>我是event2组件</h1>
    <button @click="event2">自定义事件</button>
  </div>
</template>

<script lang="ts" setup name="evnt2">
import { ref } from "vue";
const $emit = defineEmits(["event2"]);
const callback = (info: string) => {
  console.log(`我是event2组件${info}`);
};
const event2 = () => {
  $emit("event2", callback);
};
</script>

<style scoped>
.event_warpper {
  height: 250px;
  width: 100%;
  color: #000;
  background-color: aqua;
}
</style>
